<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <link rel="alternate icon" type="image/png" href="../img/favicon.png">
  <link rel="stylesheet" href="../css/amazeui.min.css">
  <link rel="stylesheet" href="../css/wap.css">
  <title>写日志 - 迷你日志</title>
</head>
<body style="background:#ececec">
  <div class="pet_mian" id="app" >
    <div class="pet_head">
      <header data-am-widget="header"
          class="am-header am-header-default pet_head_block">
        <div class="am-header-left am-header-nav ">
          <a href="/mininote/" class="iconfont pet_head_jt_ico">&#xe601;</a>
        </div>
<div class="pet_news_list_tag_name">写日志</div>
        <div class="am-header-right am-header-nav">
          <a href="javascript:;" class="iconfont pet_head_gd_ico">&#xe600;</a>
        </div>
      </header>
    </div>

    <div class="pet_more_list">
      <div class="pet_more_list_block">
        <div class="iconfont pet_more_close">×</div>
        <div class="pet_more_list_block">
          <div class="pet_more_list_block_name">
            <div class="pet_more_list_block_name_title">迷你日志</div>
            <a class="pet_more_list_block_line" href="/mininote/"> <i class="iconfont pet_nav_zhangzhishi pet_more_list_block_line_ico">&#xe607;</i>
              <div class="pet_more_list_block_line_font">首页</div>
            </a>
            <a class="pet_more_list_block_line" href="/mininote/new.html" > <i class="iconfont pet_nav_xinxianshi pet_more_list_block_line_ico">&#xe61e;</i>
              <div class="pet_more_list_block_line_font">新增</div>
            </a>
            <a class="pet_more_list_block_line" href="/mininote/login.html" >
              <i class="iconfont pet_nav_kantuya pet_more_list_block_line_ico">&#xe62c;</i>
              <div class="pet_more_list_block_line_font">退出</div>
            </a>
            <div class="pet_more_list_block_name_title pet_more_list_block_line_height">小白接口 OkayApi</div>
            <a class="pet_more_list_block_line" href="http://www.okayapi.com/?f=mininote" target="_blank" >
              <i class="iconfont pet_nav_mengzhuanti pet_more_list_block_line_ico">&#xe61e;</i>
              <div class="pet_more_list_block_line_font">官网</div>
            </a>
            <a class="pet_more_list_block_line" href="http://www.okayapi.com/docs/#/v2.0/README" target="_blank"  >
              <i class="iconfont pet_nav_bk pet_more_list_block_line_ico">&#xe607;</i>
              <div class="pet_more_list_block_line_font">文档</div>
            </a>
            <a class="pet_more_list_block_line" href="http://admin.okayapi.com/?r=Site/Index" target="_blank" >
              <i class="iconfont pet_nav_wd pet_more_list_block_line_ico">&#xe62c;</i>
              <div class="pet_more_list_block_line_font">后台</div>
            </a>
          </div>
        </div>

      </div>
    </div>

      <div class="pet_content pet_content_list">
        <div class="pet_grzx">

            <form class="am-form">
                <fieldset>
                    <br />
                    <!-- <legend>添加新日志</legend> -->

                    <div class="am-form-group">
                        <p><input v-model="note_title" type="text" class="am-form-field am-round" placeholder="请在输入日志标题"/></p>
                    </div>

                    <div class="am-form-group">
                        <label for="doc-ta-1">日志内容</label>
                        <textarea v-model="note_content" class="" rows="10" id="doc-ta-1"></textarea>
                    </div>

                </fieldset>
            </form>

            <p><button v-on:click="postNew" class="am-btn am-btn-success  am-btn-block">保存日志</button> <br />{{ tips }}</p>

            <div class="pet_article_dowload">
                  <div class="pet_article_dowload_title">小白接口开发示例</div>
                  <div class="pet_article_dowload_content"><div class="pet_article_dowload_triangle"></div>
                  <div class="pet_article_dowload_ico"><img src="../img/logo_min.png" alt=""></div>
                  <div class="pet_article_dowload_content_font">
            小白接口，是免费，免开发，直接可用的云端数据接口！<br/>我们致力于提供让每个开发者都能轻松使用的云端接口。
                  </div>
                  </div>
              </div>

        </div>

        <div class="pet_article_footer_info">Copyright © 2018 OkayApi All Rights Reserved</div>
      </div>
    </div>
    <script src="../js/jquery-3.2.1.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/amazeui.min.js"></script>

    <script>
$(function(){

    // 动态计算新闻列表文字样式
    auto_resize();
    $(window).resize(function() {
        auto_resize();
    });
    /**
    $('.am-list-thumb img').load(function(){
        auto_resize();
    });
    $('.pet_article_like li:last-child').css('border','none');
        **/
        function auto_resize(){
        $('.pet_list_one_nr').height($('.pet_list_one_img').height());
                // alert($('.pet_list_one_nr').height());
    }
        $('.pet_article_user').on('click',function(){
            if($('.pet_article_user_info_tab').hasClass('pet_article_user_info_tab_show')){
                $('.pet_article_user_info_tab').removeClass('pet_article_user_info_tab_show').addClass('pet_article_user_info_tab_cloes');
            }else{
                $('.pet_article_user_info_tab').removeClass('pet_article_user_info_tab_cloes').addClass('pet_article_user_info_tab_show');
            }
        });

        $('.pet_head_gd_ico').on('click',function(){
            $('.pet_more_list').addClass('pet_more_list_show');
       });
        $('.pet_more_close').on('click',function(){
            $('.pet_more_list').removeClass('pet_more_list_show');
        });
});
</script>



    <script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            note_title: '',
            note_content: '',
            tips: ''
        },
        methods: {
            postNew: function (event) {
                if (!this.checkForm()) {
                    return;
                }

                var _self = this

                var metaData = {
                    note_title: this.note_title,
                    note_content: this.note_content
                }

                $.ajax({
                  url: '/okayapi.php',
                  dataType: 'json',
                  data: { s: 'App.User_Set.Add', key: 'mini_note', data: JSON.stringify(metaData), visiable: 'private' }
                }).done(function (rs) {
                    if (rs.data && rs.data.err_code == 0) {
                        _self.tips = '添加成功！正在返回首页……';

                        window.location.href = '/mininote/';
                    } else {
                        _self.tips = rs.data.err_msg        
                    }
                });
            },
            checkForm: function() {
                if (this.note_title.length == 0) {
                    this.tips = '小主，日志标题还没填哦~';
                    return false;
                }
                if (this.note_content.length == 0) {
                    this.tips = '小主，日志内容还没有哦~';
                    return false;
                }
                return true;
            }
        }
    })
    </script>

</body>
  </html>
